<template>
   <div class="vue-drr clearfix">
     <el-scrollbar style="height: 100%">
    <div class="main">
      <el-card class="box-card mb15" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="fs16"><a class="ml5" target="_blank" href="https://github.com/Alvin-Liu/vue-drr">https://github.com/Alvin-Liu/vue-drr</a></span>
        </div>
        <div class="fs14 p10 lh20 text-left">
          <code>
            npm install --save vue-drr<br>
            <br>
            import VueDrr from 'vue-drr'<br>
            components:{<br>
              &nbsp;&nbsp;vueDrr<br>
            }
          </code>
        </div>
      </el-card>
      <div class="container">
        <vue-drr
          :x="x"
          :y="y"
          :angle="angle"
          :w="width"
          :h="height"
          :parent="true"
          @dragging="handleDragging"
          @resizing="handleResizing"
          @rotating="handleRotating"
        >
          <p>x: {{ x }}, y: {{ y }}, angle: {{ angle }}, width: {{ width }}, height: {{ height }}</p>
        </vue-drr>
      </div>
    </div>
     </el-scrollbar>
  </div>
</template>

<script>
import vueDrr from 'vue-drr'

export default {
  name: 'VueDrr',
  components: {
    vueDrr
  },
  data: function () {
    return {
      width: 100,
      height: 100,
      x: 50,
      y: 50,
      angle: 30
    }
  },
  methods: {
    handleResizing: function (x, y, width, height) {
      this.x = x
      this.y = y
      this.width = width
      this.height = height
    },
    handleDragging: function (x, y) {
      this.x = x
      this.y = y
    },
    handleRotating: function (angle) {
      this.angle = angle
    }
  }
}
</script>
<style lang="scss">
.vue-drr{
  margin: 0 auto;
  overflow: hidden;
  .main{
    padding: 10px;
  }
  .container {
    position: relative;
    top: 10px;
    left: 0;
    width: 100%;
    height: 350px;
    border: 1px solid red;
  }
}
</style>
